<?php 
error_reporting(E_ALL);
            ini_set('display_errors','On');
// echo $this->js->ajax("ok","/mvc/blog/create");
$this->layout = '~/views/shared/_defaultLayout.php';
?>
<script type="text/javascript">
  $(document).ready(function() {
    var max_fields      = 10; //maximum input boxes allowed
    var wrapper         = $(".input_fields_wrap"); //Fields wrapper
    var add_button      = $(".add_field_button"); //Add button ID
   
    var x = 1; //initlal text box count
    $(add_button).click(function(e){ //on add input button click
        e.preventDefault();
        if(x < max_fields){ //max input box allowed
            x++; //text box increment
            $(add_button).before('<div class="heelo"><input type="text" class="form-control" name="name[]"placeholder="Syllabus Name" /><a href="#" class="remove_field">Remove</a></div>'); //add input box
        }
    });
   
    $(wrapper).on("click",".remove_field", function(e){ //user click on remove text
        e.preventDefault(); $(this).parent('div').remove(); x--;
    })
});
</script>
<script>
// function validateForm() {
//     var x = document.forms["myForm"]['name'].value;
//     if (x==null || x=="") {
//         alert("First name must be filled out");
//         return false;
//     }
// }
// </script>
<div class="block bgWhite">
  <div class="content"><div id='bloglist'></div></div>
</div>
  <div class="content">
  <?php $unserialize_meta=unserialize($getSubject[0]['name']);
  foreach ($err as $error) {
    // echo $error;
  }

  ?>
  <div class="col-xs-6 col-md-7">
<form class="form-horizontal" action="" role="form" method="post" enctype="multipart/form-data" name="myForm" onsubmit="return validateForm()">
    <div class="form-group">
    <div class="col-sm-10">      
    <label>Course Name</label>
    <select name="course_id" class="form-control" value="">
    <?php foreach ($getscourse as $item) { 
      ?>
        <option value="<?php echo $item['id']; ?>"><?php echo $item['name']; ?></option>
        <?php } ?>
    </select>
    </div>
    </div>
    <div class="form-group">
    <div class="col-sm-10">      
    <label>Subject Name</label>
    <select name="subject_id" class="form-control" value="">
    <?php foreach ($unserialize_meta as $items) { 
      ?>
        <option value="<?php echo $getSubject[0]['id']; ?>"><?php echo $items; ?></option>
        <?php } ?>
    </select>
    </div>
    </div>
      <div class="input_fields_wrap">
      <div class="form-group">
      <div class="col-sm-10">
      <label>Syllabus Name</label>
      <input type="text" class="form-control" placeholder="Syllabus Name" name="name" value="">
      <?php echo (isset($err['name'])) ? $err['name']:null ?>
      <input type="hidden" class="form-control" placeholder="Course Name" name="id" value="<?php echo (isset($getSyllabus['id'])) ? $getSyllabus['id']:null ?>">
      <input type="hidden" class="form-control" placeholder="Course Name" name="create_date" value="">
      <input type="hidden" class="form-control" placeholder="Course Name" name="modified_date" value="">
    </div>
    </div>
    <div class="form-group">
    <div class="col-sm-10">
  <button class="add_field_button btn btn-primary">Add Fields</button>
  </div>
  </div>
  </div>
  <div class="form-group">
      <button type="submit" class="btn btn-primary" name="usersubmit" value="">Add</button>
  </div>
</form>
</div>
</div>